import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:safetymonitor/app/core/values/gaps.dart';

import '../custom_modele/custom_file_upload_page.dart';

/// 预警报警dialog
class CzAlarmTips extends StatelessWidget {
  const CzAlarmTips({
    required this.func,
    super.key,
    this.contentWidget,
    this.title,
  });

  // 标题
  final String? title;

  final Widget? contentWidget;

  final Function(bool b) func;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(horizontal: 20.w),
      alignment: Alignment.center,
      child: Container(
        height: 550.w,
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.all(Radius.circular(10.w)),
        ),
        child: Stack(
          children: [
            SingleChildScrollView(
              child: Container(
                  padding:
                      EdgeInsets.symmetric(horizontal: 20.w, vertical: 18.w),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        title ?? '提示',
                        style: TextStyle(
                            color: const Color(0xFF1D3452),
                            fontSize: 18.sp,
                            fontWeight: FontWeight.w500),
                      ),
                      contentWidget ?? Container(),
                      AppGaps.vGap30,
                      Row(
                        children: [
                          Expanded(
                              child: ElevatedButton(
                            style: ButtonStyle(
                              backgroundColor: MaterialStateProperty.all(
                                  const Color(0xFFC2CEF7)),
                            ),
                            child: Text(
                              '取消',
                              style: TextStyle(
                                  fontSize: 16.sp,
                                  color: const Color(0xFF1847E3)),
                            ),
                            onPressed: () {
                              Navigator.pop(context);
                            },
                          )),
                          AppGaps.hGap14,
                          Expanded(
                              child: ElevatedButton(
                            style: ButtonStyle(
                              backgroundColor: MaterialStateProperty.all(
                                  const Color(0xff5C6DFF)),
                            ),
                            child: Text(
                              '确认$title',
                              style: TextStyle(
                                  fontSize: 16.sp, color: Colors.white),
                            ),
                            onPressed: () {
                              func(true);
                              Navigator.pop(context);
                            },
                          )),
                        ],
                      )
                    ],
                  )),
            ),
            Positioned(
                top: 0,
                right: 0,
                child: IconButton(
                  icon: Container(
                    width: 30.w,
                    height: 30.w,
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(15.w)),
                    ),
                    child: Icon(
                      Icons.close,
                      color: Colors.black,
                      size: 21.w,
                    ),
                  ),
                  onPressed: () {
                    func(false);
                    Navigator.pop(context);
                  },
                ))
          ],
        ),
      ),
    );
  }
}
